{$CLEO .qa}
{$USE CLEO+}
{$USE newOpcodes}
{$USE ini}

0000: NOP 

script_name "GNGBLT"


20@ = -1
31@ = 0

const
    exception_1 = 10@
    exception_2 = 11@
    exception_3 = 12@
    exception_4 = 13@
    exception_5 = 14@
    exception_6 = 15@
    exception_7 = 16@
    bulletproof_1 = 19@
    bulletproof_2 = 18@
end

0085: exception_1 = 0@ // (int)
0085: exception_2 = 1@ // (int)
0085: exception_3 = 2@ // (int)
0085: exception_4 = 3@ // (int)
0085: exception_5 = 4@ // (int)
0085: exception_6 = 5@ // (int)
0085: exception_7 = 6@ // (int)
0085: bulletproof_1 = 7@ // (int)
0085: bulletproof_2 = 8@ // (int)

while true
wait 0 
    if
        887A:   not gang_war_in_progress
    then
        0A93: terminate_this_custom_script
    end
    

            if or
                856D: not actor 20@ defined
                856D: not actor 21@ defined
                856D: not actor 22@ defined
                856D: not actor 23@ defined
                856D: not actor 24@ defined
                856D: not actor 25@ defined
                856D: not actor 26@ defined
            then
                27@ = 0
                while 0EA7: get_any_char_no_save_recursive 27@ progress_to 27@ char_to 0@

                if
                    31@ >= 7
                then
                    31@ = 0
                end
                    089F: get_actor 0@ pedtype_to 1@
                    if and
                        1@ >= 7 //  7, 8, 9, 10, 11, 12, 13, 14
                        1@ <= 14
                        not 1@ == 8
                    then
                        if and
                            is_char_script_controlled 0@
                            not locate_char_distance_to_char $PLAYER_ACTOR char 0@ radius 20.0
                        then
                            0A8D: 1@  = read_memory 0x96AB64 size 1 virtual_protect 0 //  mov     eax, ds:_ZN9CGangWars5StateE ; CGangWars::State
                            if 1@ == 2 // 1 
                            then 2@ = 15
                            end
                            if 1@ == 4 // 2 
                            then 2@ = 45
                            end
                            if 1@ == 6 // 3 
                            then 2@ = 80
                            end
                            
                            if
                                0E4D: random_percent 2@
                            then
                                if and
                                    803B:   not 0@ == 20@  // (int)
                                    803B:   not 0@ == 21@  // (int)
                                    803B:   not 0@ == 22@  // (int)
                                    803B:   not 0@ == 23@  // (int)
                                    803B:   not 0@ == 24@  // (int)
                                    803B:   not 0@ == 25@  // (int)
                                    803B:   not 0@ == 26@  // (int)
                                then
                                    
                                    0085: 20@(31@,1i) = 0@ // (int)
                                    
                                    0209: 3@ = random_int_in_ranges 1 3
                                    if 3@ == 1
                                    then 0085: 1@ = bulletproof_1 // (int)
                                    end
                                    if 3@ == 2
                                    then 0085: 1@ = bulletproof_2 // (int)
                                    end
                                    
                                    if and
                                        82F2:   not actor 0@ model == exception_1
                                        82F2:   not actor 0@ model == exception_2
                                        82F2:   not actor 0@ model == exception_3
                                        82F2:   not actor 0@ model == exception_4
                                        82F2:   not actor 0@ model == exception_5
                                        82F2:   not actor 0@ model == exception_6
                                        82F2:   not actor 0@ model == exception_7
                                    then

                                        0F02:  20@(31@,1i) special_model 1@ bone 3 offset 0.27 0.02 0 rotation 0 0 -4.5 scale 2@ // bone 34 left hand, 24 right hand, 9 had, 3 tors, 4 upper tors
                                        0E37: set_render_object_scale 2@ 1.121 1.237 1.237

                                        035F: actor 20@(31@,1i) armour += 100
                                        0A8D: 1@  = read_memory 0x96AB64 size 1 virtual_protect 0 //  mov     eax, ds:_ZN9CGangWars5StateE ; CGangWars::State
                                        if 1@ == 2 // 1 
                                        then 035F: actor 20@(31@,1i) armour += -85
                                        end
                                        if 1@ == 4 // 2 
                                        then 035F: actor 20@(31@,1i) armour += -55
                                        end
                                        
                                    end
                                    
                                    31@ += 1
                                end
                            else
                                if and
                                    803B:   not 0@ == 20@  // (int)
                                    803B:   not 0@ == 21@  // (int)
                                    803B:   not 0@ == 22@  // (int)
                                    803B:   not 0@ == 23@  // (int)
                                    803B:   not 0@ == 24@  // (int)
                                    803B:   not 0@ == 25@  // (int)
                                    803B:   not 0@ == 26@  // (int)
                                then
                                    0085: 20@(31@,1i) = 0@ // (int)
                                    31@ += 1
                                end
                            end
                        end
                    end
                end
            end

end
